<%@page contentType="text/html;charset=UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/include/taglibs.jsp"%>
<%@ include file="/include/meta.jsp"%>
<script>
var syFlowId="i_sy_syFlow_datagrid";
var syFlowDt;
var syFlowUploadDg;
var syFlowUploadFm;
$(function(){
	var columns= [ [ {
		field : 'id',
		title : '唯一编号',
		width : 150,
		checkbox : true
	}, {
		field : 'processDefinitionName',
		title : '流程名称',
		width : 150
	}, {
		field : 'processDefinitionKey',
		title : '流程编号',
		width : 150
	}, {
		field : 'version',
		title : '版本',
		width : 150
	},{
		field : 'DEPLOY_TIME',
		title : '发布时间',
		width : 150
	},{
		field : 'processDefinitionId',
		title : '操作',
		width : 150,
		formatter: function(value,row,index){
			var src = '\'${ctx}'+actionUrl("/sys/","syFlow","Get_FlowImageByDefId")+'?processDefinitionId='+row.processDefinitionId+'\'';;
			return '<a href="javascript:void(0)" onclick="showImage(\''+row.processDefinitionName+'\','+src+')" >查看流程图</a>';
		}
	}] ];
	syFlowUploadDg = $('#i_sy_syFlow_upload_dialog');
	syFlowUploadFm =$('#i_sy_syFlow_upload_dialog_form');
	syFlowUploadFm.attr('action',"${ctx}"+actionUrl('/sys/','syFlow','Upload'));
	var dataGrid = {
			id:syFlowId,
			url:"${ctx}"+actionUrl('/sys/','syFlow','List'),
			dId:'deploymentId',
			columns:columns
	};
	syFlowDt=gGrid2(dataGrid);	
	gDataGridToolbarBtn(syFlowId,'icon-add','upLoadFun();',"新建");
	var strdelfun="dorow(syFlowId,'您是否确定要删除选择的数据','${ctx}"+actionUrl('/sys/','syFlow','Delete')+"',updateFun,'d')";
	gDataGridToolbarBtn(syFlowId,'icon-remove',strdelfun,"删除");
});

function upLoadFun(){
	syFlowUploadDg.dialog('open');
}

function showImage(name,src){
	$('#flowimagedlg').dialog({   
	    title: name+'-流程图',  
		height:($(self).height()*2)/3,
		top:($(self).height()*1)/3,
	    closed: true,   
	    fit:true,
	    content:'<img src="'+src+'" />',
	    modal: false  
	});   
	$('#flowimagedlg').dialog('open');
}

function submitUploadForm(){
	syFlowUploadFm.form('submit',{
		success:function(d){
			syFlowDt.datagrid('reload');
			syFlowUploadDg.dialog('close');
			d=$.parseJSON(d);
			log(d.info);
			}
	});
}

function updateFun(d){
	syFlowDt.datagrid('reload');
}
</script>
</head>
<body>
<div id="i_sy_syFlow_datagrid_toolbar"
		style="padding: 2px 0">
		<table cellpadding="0" cellspacing="0" style="width: 100%">
			<tr>
				<td style="padding-left: 2px"
					id="i_sy_syFlow_datagrid_toolbtn"></td>
				<td style="text-align: right; padding-right: 2px"><input
					class="easyui-searchbox" data-options="prompt:'请输入搜索关键词'"
					style="width: 200px" searcher="dSearch"
					id="i_sy_syFlow_datagrid_searchbox"
					pdt="i_sy_syFlow_datagrid"></input>
					<div id="i_sy_syFlow_datagrid_dSComb"
						style="width: 120px"></div></td>
			</tr>
		</table>
	</div>
 <table  id="i_sy_syFlow_datagrid" ></table> 
 <div id="i_sy_syFlow_upload_dialog" class="easyui-dialog" title="上传" style="width:400px;height:100px;"  
        data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true"> 
        <form id="i_sy_syFlow_upload_dialog_form" action="" enctype="multipart/form-data" method="post" >
        	文件:<input type="file" name="uploadFile">
        	 <input type="button" value="上传" onClick="submitUploadForm();" />
		</form> 
</div>  
<div id="flowimagedlg" reftype="14"></div>  
</body>
</html>
	